const path = require("path");
const webpack = require("webpack");

const resolve = dir => path.join(__dirname, '.', dir);

module.exports = {
  devtool: '#source-map',
  entry: {
    'vue-compass': './src/index.js'
  },
  output: {
    path: resolve('dist'),
    filename: '[name].min.js',
    library: 'vue-compass',
    libraryExport: 'default',
    libraryTarget: 'umd',
    globalObject: 'this',
    umdNamedDefine: true
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /(node_modules)/,
        loader: 'babel-loader'
      }
    ]
  },
  plugins: [
    new webpack.DefinePlugin({
      "process.env": {
        NODE_ENV: JSON.stringify("production")
      }
    })
  ]
};
